<template>
	<div class="box">
		<h2>时间</h2>
		<p>当天时间：{{today1}}({{today}})</p>
		<p>农历：{{nl}}</p>
		<p>星期{{week.zw}}({{week.sz}})</p>
		<p>本月：{{curMonth.firstDay}} ~ {{curMonth.lastDay}}</p>
		<p>本周：{{curWeek.firstDay}} ~ {{curWeek.lastDay}}</p>
		<p>本周一至今：<span v-for="day in curWeekEveryDay" :key="day">{{day}}，</span></p>
		<p>7天前：{{lastweek}}</p>
	</div>
</template>

<style>
span {
  margin-right: 10px;
}
</style>
<script>
import {
  getToday,
  getWeek,
  getCurMonth,
  getCurWeek,
  getEveryDay,
  getTargetDay,
  getLunarCalendar
} from "@/util/date-util";

export default {
  name: "DateTest",
  data() {
    return {
      today: "",
      today1: "",
      nl: "",
      week: "",
      curMonth: "",
      curWeek: "",
      curWeekEveryDay: [],
      lastweek: ""
    };
  },
  created: function() {
    this.init();
  },
  methods: {
    init() {
      this.today = getToday();
      this.today1 = getToday("zw");
      this.nl = getLunarCalendar();
      this.week = getWeek();
      this.curMonth = getCurMonth();
      this.curWeek = getCurWeek();
      this.curWeekEveryDay = getEveryDay(getCurWeek().firstDay);
      this.lastweek = getTargetDay("-7");
    }
  }
};
</script>
